package test.test_7_8;

public class Demo05 {
    public static void main(String[] args) {


        String password = getPassword();
        getRandomNum(password);



    }

    private static void getRandomNum(String password) {
        //打印000 - 999
        A:for(int i = 0; i <= 9; i++) {
            B:for (int j = 0; j <=9 ; j++) {
                C:for (int k = 0; k <=9 ; k++) {
                    String str = "";
                    str = str + i + j + k;
                    System.out.println(str);
                    if (password.equals(str)) {
                        return;
                    }
                }
            }
        }
    }

    private static String getPassword() {
        //随机生成一个000-999的随机数密码
        String password = "";
        for (int i = 0; i < 3; i++) {
            password = password + ((int) (Math.random() * 10));
        }
        System.out.println("password = " + password);
        return password;
    }

    private static void extracted(int i) {
        String str = null;
        if (i >= 0 && i <= 9) {
            String str1 = "00" + i;
            str = str1;
            System.out.print(str + " ");
        } else if (i >= 10 && i <= 99) {
            String str2 = "0" + i;
            str = str2;
            System.out.print(str + " ");
        } else {
            str = Integer.toString(i);
            System.out.println(str);
        }

    }



}
